# !/usr/bin/python3
# coding=utf-8

import codecs

share_id_lst = ['sh601318', 'sz002230', 'sz300059']

for share_id in share_id_lst:
    with codecs.open('share_data_%s.csv' % share_id, encoding='UTF-8') as rfp:
        with codecs.open('share_data_%s_cleared.csv' % share_id, 'w', encoding='UTF-8') as wfp:
            last_line = ''
            for line in rfp.readlines():
                if line != last_line:
                    wfp.write(line)
                    last_line = line
